<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OpenLoong Dynamics Control: joystick_interpreter.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OpenLoong Dynamics Control
   &#160;<span id="projectnumber">v0.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_692f640cc74363071c5c0e14282656e9.html">algorithm</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">joystick_interpreter.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">This is part of OpenLoong Dynamics Control, an open project for the control of biped robot,</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">Copyright (C) 2024 Humanoid Robot (Shanghai) Co., Ltd, under Apache 2.0.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">Feel free to use in any purpose, and cite OpenLoong-Dynamics-Control in any style, to contribute to the advancement of the community.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> &lt;https://gitee.com/panda_23/openloong-dyn-control.git&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> &lt;web@openloong.org.cn&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160; </div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;ramp_trajectory.h&quot;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;data_bus.h&quot;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html">   18</a></span>&#160;<span class="keyword">class </span><a class="code" href="classJoyStickInterpreter.html">JoyStickInterpreter</a> {</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#ac9a30ce112c2ca55df0e43f9d3bd1eb5">   20</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="classJoyStickInterpreter.html#ac9a30ce112c2ca55df0e43f9d3bd1eb5">dt</a>;        </div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#ae105898be43b94218daf216692bfeff3">   21</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="classJoyStickInterpreter.html#ae105898be43b94218daf216692bfeff3">thetaZ</a>{0}; </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#add76f0aef78793de367bdb155106d284">   27</a></span>&#160;    <a class="code" href="classJoyStickInterpreter.html#add76f0aef78793de367bdb155106d284">JoyStickInterpreter</a>(<span class="keywordtype">double</span> dtIn): <a class="code" href="classJoyStickInterpreter.html#ac9a30ce112c2ca55df0e43f9d3bd1eb5">dt</a>{dtIn}, vxLGen(dtIn), vyLGen(dtIn), wzLGen(dtIn){};</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classJoyStickInterpreter.html#acbb8973ad5152b5a424c18f11d8d2c06">setVxDesLPara</a>(<span class="keywordtype">double</span> vxDesLIn, <span class="keywordtype">double</span> timeToReach);</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classJoyStickInterpreter.html#a527747a54ed75384ba6c5d1065647cbd">setVyDesLPara</a>(<span class="keywordtype">double</span> vyDesLIn, <span class="keywordtype">double</span> timeToReach);</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classJoyStickInterpreter.html#ada765f5a0ac381acc320f32311ce2b24">setWzDesLPara</a>(<span class="keywordtype">double</span> wzDesLIn, <span class="keywordtype">double</span> timeToReach);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classJoyStickInterpreter.html#a10f37ffd17dc84d82cb6f83731c5f6a1">setIniPos</a>(<span class="keywordtype">double</span> posX, <span class="keywordtype">double</span> posY);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classJoyStickInterpreter.html#a95034121531c0693b36da5b15c45bc72">step</a>();</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#a50f3f13bc710fd03b836dde7376092d5">   61</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="classJoyStickInterpreter.html#a50f3f13bc710fd03b836dde7376092d5">vx_W</a>{0}, </div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#a06a0a1416b12e75ef23acd9ccc4afe9b">   62</a></span>&#160;        <a class="code" href="classJoyStickInterpreter.html#a06a0a1416b12e75ef23acd9ccc4afe9b">vy_W</a>{0};    </div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#ac414f96719899367d5ca73e19db4162c">   63</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="classJoyStickInterpreter.html#ac414f96719899367d5ca73e19db4162c">px_W</a>{0}, </div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#a8ed9e02d8397afdcc9dc9b5bd8a53da9">   64</a></span>&#160;        <a class="code" href="classJoyStickInterpreter.html#a8ed9e02d8397afdcc9dc9b5bd8a53da9">py_W</a>{0};    </div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#aa15a5d96e8414866a692c201a5686674">   65</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="classJoyStickInterpreter.html#aa15a5d96e8414866a692c201a5686674">vx_L</a>{0}, </div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#ae90530392a244a9b3498f215a9c13d48">   66</a></span>&#160;        <a class="code" href="classJoyStickInterpreter.html#ae90530392a244a9b3498f215a9c13d48">vy_L</a>{0},    </div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="classJoyStickInterpreter.html#ae5b60ab4737b0c12cbf3d32391c75039">   67</a></span>&#160;        <a class="code" href="classJoyStickInterpreter.html#ae5b60ab4737b0c12cbf3d32391c75039">wz_L</a>{0};    </div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classJoyStickInterpreter.html#a5c08c43644dead1f35f6095dffabc988">dataBusWrite</a>(<a class="code" href="structDataBus.html">DataBus</a> &amp;dataBus);</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classJoyStickInterpreter.html#a22cff0fbc0c04060eed3a24d4e550bde">reset</a>();</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <a class="code" href="classRampTrajectory.html">RampTrajectory</a> vxLGen, </div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        vyLGen,            </div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        wzLGen;            </div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160; </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;};</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160; </div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassJoyStickInterpreter_html_a8ed9e02d8397afdcc9dc9b5bd8a53da9"><div class="ttname"><a href="classJoyStickInterpreter.html#a8ed9e02d8397afdcc9dc9b5bd8a53da9">JoyStickInterpreter::py_W</a></div><div class="ttdeci">double py_W</div><div class="ttdoc">generated position in y direction w.r.t world frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00064">joystick_interpreter.h:64</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_a10f37ffd17dc84d82cb6f83731c5f6a1"><div class="ttname"><a href="classJoyStickInterpreter.html#a10f37ffd17dc84d82cb6f83731c5f6a1">JoyStickInterpreter::setIniPos</a></div><div class="ttdeci">void setIniPos(double posX, double posY)</div><div class="ttdoc">Set initial position.</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8cpp_source.html#l00055">joystick_interpreter.cpp:55</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_a95034121531c0693b36da5b15c45bc72"><div class="ttname"><a href="classJoyStickInterpreter.html#a95034121531c0693b36da5b15c45bc72">JoyStickInterpreter::step</a></div><div class="ttdeci">void step()</div><div class="ttdoc">update the joystick command</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8cpp_source.html#l00022">joystick_interpreter.cpp:22</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_a527747a54ed75384ba6c5d1065647cbd"><div class="ttname"><a href="classJoyStickInterpreter.html#a527747a54ed75384ba6c5d1065647cbd">JoyStickInterpreter::setVyDesLPara</a></div><div class="ttdeci">void setVyDesLPara(double vyDesLIn, double timeToReach)</div><div class="ttdoc">Set the desired vy in body frame.</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8cpp_source.html#l00014">joystick_interpreter.cpp:14</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_ae105898be43b94218daf216692bfeff3"><div class="ttname"><a href="classJoyStickInterpreter.html#ae105898be43b94218daf216692bfeff3">JoyStickInterpreter::thetaZ</a></div><div class="ttdeci">double thetaZ</div><div class="ttdoc">yaw angle command in body frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00021">joystick_interpreter.h:21</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_a06a0a1416b12e75ef23acd9ccc4afe9b"><div class="ttname"><a href="classJoyStickInterpreter.html#a06a0a1416b12e75ef23acd9ccc4afe9b">JoyStickInterpreter::vy_W</a></div><div class="ttdeci">double vy_W</div><div class="ttdoc">generated velocity in y direction w.r.t world frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00062">joystick_interpreter.h:62</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_ae5b60ab4737b0c12cbf3d32391c75039"><div class="ttname"><a href="classJoyStickInterpreter.html#ae5b60ab4737b0c12cbf3d32391c75039">JoyStickInterpreter::wz_L</a></div><div class="ttdeci">double wz_L</div><div class="ttdoc">generated angular velocity in z direction, w.r.t body frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00067">joystick_interpreter.h:67</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html"><div class="ttname"><a href="classJoyStickInterpreter.html">JoyStickInterpreter</a></div><div class="ttdoc">The class serves as interface from joystick to motion controller.</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00018">joystick_interpreter.h:18</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_aa15a5d96e8414866a692c201a5686674"><div class="ttname"><a href="classJoyStickInterpreter.html#aa15a5d96e8414866a692c201a5686674">JoyStickInterpreter::vx_L</a></div><div class="ttdeci">double vx_L</div><div class="ttdoc">generated linear velocity in x direction w.r.t body frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00065">joystick_interpreter.h:65</a></div></div>
<div class="ttc" id="aclassRampTrajectory_html"><div class="ttname"><a href="classRampTrajectory.html">RampTrajectory</a></div><div class="ttdoc">This class implements a ramp trajectory object.</div><div class="ttdef"><b>Definition:</b> <a href="ramp__trajectory_8h_source.html#l00017">ramp_trajectory.h:17</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_a5c08c43644dead1f35f6095dffabc988"><div class="ttname"><a href="classJoyStickInterpreter.html#a5c08c43644dead1f35f6095dffabc988">JoyStickInterpreter::dataBusWrite</a></div><div class="ttdeci">void dataBusWrite(DataBus &amp;dataBus)</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8cpp_source.html#l00036">joystick_interpreter.cpp:36</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_ada765f5a0ac381acc320f32311ce2b24"><div class="ttname"><a href="classJoyStickInterpreter.html#ada765f5a0ac381acc320f32311ce2b24">JoyStickInterpreter::setWzDesLPara</a></div><div class="ttdeci">void setWzDesLPara(double wzDesLIn, double timeToReach)</div><div class="ttdoc">Set the desired omega_z(wz) in body frame.</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8cpp_source.html#l00018">joystick_interpreter.cpp:18</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_a50f3f13bc710fd03b836dde7376092d5"><div class="ttname"><a href="classJoyStickInterpreter.html#a50f3f13bc710fd03b836dde7376092d5">JoyStickInterpreter::vx_W</a></div><div class="ttdeci">double vx_W</div><div class="ttdoc">generated velocity in x direction w.r.t world frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00061">joystick_interpreter.h:61</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_a22cff0fbc0c04060eed3a24d4e550bde"><div class="ttname"><a href="classJoyStickInterpreter.html#a22cff0fbc0c04060eed3a24d4e550bde">JoyStickInterpreter::reset</a></div><div class="ttdeci">void reset()</div><div class="ttdoc">reset all to 0</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8cpp_source.html#l00045">joystick_interpreter.cpp:45</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_ae90530392a244a9b3498f215a9c13d48"><div class="ttname"><a href="classJoyStickInterpreter.html#ae90530392a244a9b3498f215a9c13d48">JoyStickInterpreter::vy_L</a></div><div class="ttdeci">double vy_L</div><div class="ttdoc">generated linear velocity in y directionw.r.t body frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00066">joystick_interpreter.h:66</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_ac9a30ce112c2ca55df0e43f9d3bd1eb5"><div class="ttname"><a href="classJoyStickInterpreter.html#ac9a30ce112c2ca55df0e43f9d3bd1eb5">JoyStickInterpreter::dt</a></div><div class="ttdeci">double dt</div><div class="ttdoc">control frequency</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00020">joystick_interpreter.h:20</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_ac414f96719899367d5ca73e19db4162c"><div class="ttname"><a href="classJoyStickInterpreter.html#ac414f96719899367d5ca73e19db4162c">JoyStickInterpreter::px_W</a></div><div class="ttdeci">double px_W</div><div class="ttdoc">generated position in x direction w.r.t world frame</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00063">joystick_interpreter.h:63</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_acbb8973ad5152b5a424c18f11d8d2c06"><div class="ttname"><a href="classJoyStickInterpreter.html#acbb8973ad5152b5a424c18f11d8d2c06">JoyStickInterpreter::setVxDesLPara</a></div><div class="ttdeci">void setVxDesLPara(double vxDesLIn, double timeToReach)</div><div class="ttdoc">Set the desired vx in body frame.</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8cpp_source.html#l00010">joystick_interpreter.cpp:10</a></div></div>
<div class="ttc" id="astructDataBus_html"><div class="ttname"><a href="structDataBus.html">DataBus</a></div><div class="ttdoc">The software model for data transporting.</div><div class="ttdef"><b>Definition:</b> <a href="data__bus_8h_source.html#l00022">data_bus.h:22</a></div></div>
<div class="ttc" id="aclassJoyStickInterpreter_html_add76f0aef78793de367bdb155106d284"><div class="ttname"><a href="classJoyStickInterpreter.html#add76f0aef78793de367bdb155106d284">JoyStickInterpreter::JoyStickInterpreter</a></div><div class="ttdeci">JoyStickInterpreter(double dtIn)</div><div class="ttdoc">Construct a new Joy Stick Interpreter object.</div><div class="ttdef"><b>Definition:</b> <a href="joystick__interpreter_8h_source.html#l00027">joystick_interpreter.h:27</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
